/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK - graphics/buffers
// Copyright( c) 2015.  All Rights Reserved
//
// File:		AEVertexBufferManager.cpp
// Author:		Gianluca Belardelli
// Date:		12/02/2015
//
/////////////////////////////////////////////////////////////////////////
#include <AEEngine.h>

AEVertexBufferManager::AEVertexBufferManager( const char *lpName ) : AEResourceManager( lpName )
{
}

AEResource *AEVertexBufferManager::CreateResource( const char *lpFilename, AEINT32 nFlags )
{
	return AENULL;
}

AEVertexBuffer *AEVertexBufferManager::CreateVertexBuffer( const char *lpName, AEUINT32 uiElementCount, AEUINT32 uiStride, AEINT32 nFlags )
{
	AEASSERT_MSG( uiElementCount > 0, "Impossibile creare un vertex buffer per 0 elementi." );
	AEASSERT_MSG( uiStride > 2, "Impossibile creare un vertex buffer con stride inferiore a 2." );


	if( !lpName || strlen(lpName ) == 0 )
		return AENULL;

	AEVertexBuffer *lpBuff = new AEVertexBuffer( this, uiElementCount, uiStride, nFlags, AEFALSE, AETRUE, lpName );
	AddResource( lpBuff );

	return lpBuff;
}

AEIndexBuffer *AEVertexBufferManager::CreateIndexBuffer( const char *lpName, AEUINT32 uiElementCount, AEIndexFormat eFormat, AEINT32 nFlags )
{
	AEASSERT_MSG( uiElementCount > 0, "Impossibile creare un index buffer per 0 elementi." );

	if( !lpName || strlen(lpName ) == 0 )
		return AENULL;

	AEIndexBuffer *lpBuff = new AEIndexBuffer( this, uiElementCount, eFormat, nFlags, AEFALSE, AETRUE, lpName );
	AddResource( lpBuff );

	return lpBuff;
}
